<template>
  <el-card>
    <div class="card-header">
      <span>Card name</span>
      <el-button type="primary">发布文章</el-button>
    </div>
    <hr>

    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="文章分类">
        <el-select v-model="formInline.region" placeholder="请选择" clearable>
          <el-option label="时事" value="时事" />
          <el-option label="篮球" value="篮球" />
        </el-select>
      </el-form-item>


      <el-form-item label="发布状态">
        <el-select v-model="formInline.region" placeholder="请选择" clearable>
          <el-option label="已发布" value="shanghai" />
          <el-option label="草稿" value="beijing" />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit">Query</el-button>
      </el-form-item>

      <el-form-item>
        <el-button type="default" @click="onSubmit">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="title" label="文章标题" />
      <el-table-column prop="category" label="分类" />
      <el-table-column prop="time" label="发表时间" />
      <el-table-column prop="state" label="状态" /> <!-- 表格的列 -->
      <el-table-column label="操作" width="180">
        <el-button type="primary" :icon="Edit" circle />
        <el-button type="danger" :icon="Delete" circle />
      </el-table-column>
    </el-table>

    <el-pagination v-model:current-page="currentPage4" v-model:page-size="pageSize4" :page-sizes="[5, 10, 15, 20]"
      :small="small" :disabled="disabled" :background="background" layout="jumper, total, sizes, prev, pager, next"
      :total="20" @size-change="handleSizeChange" @current-change="handleCurrentChange" class="el-p" />
  </el-card>

</template>

<script lang="ts" setup>
const tableData = [
  {
    title: '标题1',
    category: '时事',
    time: '2000-01-01',
    state: '已发布',
  },
  {
    title: '标题1',
    category: '时事',
    time: '2000-01-01',
    state: '已发布',
  },
  {
    title: '标题1',
    category: '时事',
    time: '2000-01-01',
    state: '已发布',
  },
  {
    title: '标题1',
    category: '时事',
    time: '2000-01-01',
    state: '已发布',
  }
]

import {
  Delete,
  Edit
} from '@element-plus/icons-vue'

import { ref,reactive } from 'vue'

const currentPage4 = ref(1)
const pageSize4 = ref(5)
const small = ref(false)
const background = ref(true)
const disabled = ref(false)

const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}

const formInline = reactive({
  user: '',
  region: '',
  date: '',
})

const onSubmit = () => {
  console.log('submit!')
}
</script>



<style scoped>
.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
.demo-pagination-block+.demo-pagination-block {
  margin-top: 10px;
}

.demo-pagination-block .demonstration {
  margin-bottom: 16px;
}
.el-p {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.card-header {
  display: flex;
  justify-content: space-between;
}
</style>
